<template>
  <el-form :inline="true" :model="form">
    <!-- 选择器 -->
    <el-form-item>
      <el-select
        v-model="form.orderStatusCode"
        :placeholder="$t('workOrderMg.orderStatusName')"
        style="width: 100px"
        clearable
      >
        <!-- <el-option :value="''" :label="'全部'">全部</el-option> -->
        <el-option
          v-for="(wotItem, index) in woQuryType"
          :key="index"
          :label="wotItem.dictValue"
          :value="wotItem.dictKey"
        />
      </el-select>
    </el-form-item>

    <!-- 搜索属性 -->
    <el-form-item>
      <el-input
        v-model="form.workOrderId"
        :placeholder="this.$t('workOrderMg.searchWorkId')"
      />
    </el-form-item>
    <el-form-item>
      <el-input
        v-model="form.codeOrName"
        :placeholder="this.$t('workOrderMg.searchclient')"
      />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSearch">
        {{ $t('workOrderMg.search') }}
      </el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  props: {
    conditions: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      form: {
        workOrderId: '',
        codeOrName: '',
        // orderStatusCode: ''
      }
    }
  },
  computed: {
    ...mapGetters(['dicMap', 'dicCodes']),
    woType() {
      return this.dicCodes['workOrderStatus']
    },
    woQuryType() {
      // 查询状态
      return this.dicMap[this.woType]
    }
  },
  mounted() {
    this.$store.dispatch('common/getI18nDict', this.woType)
  },
  methods: {
    onSearch() {
      this.$emit(
        'update:conditions',
        Object.assign({}, this.conditions, this.form)
      )
    }
  }
}
</script>

<style></style>
